package com.huabo.contract.mysql.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.contract.mysql.entity.TblLegalLitigationsettlementMySql;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huabo
 * @since 2022-03-18
 */
public interface TblLegalLitigationsettlementMySqlMapper extends BaseMapper<TblLegalLitigationsettlementMySql> {

    @SelectProvider(type = TblLegalLitigationsettlementMySqlMapperSqlConfig.class,method = "findListByPageInfo")
    List<TblLegalLitigationsettlementMySql> findListByPageInfo(PageInfo<TblLegalLitigationsettlementMySql> pageInfo, TblLegalLitigationsettlementMySql litigation,Integer disputeid);

    @SelectProvider(type = TblLegalLitigationsettlementMySqlMapperSqlConfig.class,method ="findListByPageInfoCount")
    Integer findListByPageInfoCount(TblLegalLitigationsettlementMySql litigation,Integer disputeid);

    @Select("SELECT * FROM TBL_LEGAL_LITIGATIONSETTLEMENT TLL\n" +
            "LEFT JOIN TBL_LEGAL_DISPUTREGISTRATION TLD ON TLL.DISPUTEINFO = TLD.DISPUTEID\n" +
            "WHERE LITIGATIONID = #{litigationId}")
    @Options(useGeneratedKeys=true, keyProperty="litigationId", keyColumn="LITIGATIONID")
    TblLegalLitigationsettlementMySql findById(Integer litigationId);

    @InsertProvider(type = TblLegalLitigationsettlementMySqlMapperSqlConfig.class,method = "saveLitigationSettlement")
    @Options(useGeneratedKeys=true, keyProperty="litigationid", keyColumn="LITIGATIONID")
    void saveLitigationSettlement(TblLegalLitigationsettlementMySql litigation);

    @UpdateProvider(type = TblLegalLitigationsettlementMySqlMapperSqlConfig.class,method = "updateModifyLitigationSettlement")
    void updateModifyLitigationSettlement(TblLegalLitigationsettlementMySql oldLitigation);

    @Delete("DELETE FROM TBL_LEGAL_LITIGATIONSETTLEMENT WHERE LITIGATIONID = #{litigationid}")
    void deleteLitigationId(Integer litigationid);

    @Select("SELECT * FROM TBL_LEGAL_LITIGATIONSETTLEMENT TLL\n" +
            "LEFT JOIN TBL_LEGAL_DISPUTREGISTRATION TLD ON TLL.DISPUTEINFO = TLD.DISPUTEID\n" +
            "WHERE LITIGATIONID = #{litigationId}")
    TblLegalLitigationsettlementMySql findByLitigationid(Integer litigationid);

//    @Insert("INSERT INTO  TBL_LEGAL_LSETTLEMENT_ATT(LITIGATIONID,ATTID) VALUES (#{litigationid},#{id})")
//    void insertAttRelation(Integer litigationid, String id);

//    @Update()
//    void updateModifyLitigationSettlement(Integer litigationid);
}
